// this sets the background color of the master UIView (when there are no windows/tab groups on it)
//Titanium.UI.setBackgroundColor('#000');

// create tab group
var tabGroup = Titanium.UI.createTabGroup({id:'tabGroup1'});


var win1 = Ti.UI.createWindow({
	title:"Search",
	url:'ui/search.js',
	barColor:'#111',
	backgroundImage:'images/large_dark_stripe_wood_80565.jpeg',
})
	win2 = Ti.UI.createWindow({
	title:"About",
	url:'ui/about.js',
	barColor:'#111',
	backgroundImage:'images/large_dark_stripe_wood_80565.jpeg',
})

var tab1 = Ti.UI.createTab({id:'tab1',title:'Search',icon:'images/KS_nav_views.png',height:20,window:win1});
win1.containingTab = tab1;

//var tab2 = Ti.UI.createTab({id:'tab2',title:'Results',icon:'images/38-airplane.png',height:20,window:win3});
//win3.containingTab = tab2;

var tab3 = Ti.UI.createTab({id:'tab3',title:'About',icon:'images/KS_nav_views.png',height:20,window:win2});
win2.containingTab = tab3;

//
//  add tabs
//
tabGroup.addTab(tab1);  
//tabGroup.addTab(tab2);  
tabGroup.addTab(tab3); 

//para pasar los resultados
Ti.App.addEventListener('gotResults', function(event) {
  //Ti.API.info('You sent me: '+event.resultsText);
  
  var resultwin = Ti.UI.createWindow({
	title:"Results",
	url:'ui/results.js',
	resultsText:event.resultsText,
	timeElapsed:event.timeElapsed,
	barColor:'#111',
	backgroundImage:'images/large_dark_stripe_wood_80565.jpeg',
	});
  
	tab1.open(resultwin,{annimated:true});

});

// open tab group
tabGroup.open({transition: Titanium.UI.iPhone && Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});
